package pdf解析.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import 事务练习.entity.TbUser;

/**
 * @author caihe
 * @date 2021/6/23 12:20
 */
@Component
@Aspect
public class TestAspect {

    @Pointcut("execution(* pdf解析.controller.PdfController.pdfdemo(..))")
    public void pointCut() {
    }

    @AfterReturning(value = "pointCut()", returning = "result")
    public void deal(JoinPoint joinPoint, TbUser result) {
        System.out.println(result);
        result.setId(3);

    }

    @AfterThrowing(value = "pointCut()", throwing = "ex")
    public void throwE(JoinPoint joinPoint, Throwable ex) {
        Object[] args = joinPoint.getArgs();
        String[] argNames = ((MethodSignature) joinPoint.getSignature()).getParameterNames();

        System.out.println();
    }

}
